<template>
	<el-dialog title="填报Excel报表对话框" v-model="visible" width="400px" destroy-on-close @closed="$emit('closed')">
		<el-form :model="form" :rules="rules" ref="dialogForm" label-width="100px" label-position="left">
			<el-form-item label="报表名称" prop="title">
				<el-input v-model="form.title" placeholder="报表名称" maxlength="40" clearable></el-input>
			</el-form-item>
			<el-form-item label="报表版本" prop="version">
				<el-input v-model="form.version" placeholder="报表版本" maxlength="40" clearable></el-input>
			</el-form-item>
			<el-form-item label="报表版本" prop="remark">
				<el-input v-model="form.remark" placeholder="报表版本" maxlength="380" clearable type="textarea"></el-input>
			</el-form-item>
		</el-form>
		<template #footer>
			<el-button @click="visible=false">取 消</el-button>
			<el-button type="primary" :loading="isSaveing" @click="submit()">保 存</el-button>
		</template>
	</el-dialog>

</template>
<script>

export default {
	emits: ['success', 'closed'],
	components: {
	},
	data() {
		return {
			visible: false,
			isSaveing: false,
			excelSort: [],
			form: {
				title: '',
				version: '',
				remark:'',
			},
			rules: {
				title: [
					{required: true, message: '报表名称不能为空', trigger: 'blur'}
				],
				version: [
					{required: true, message: '报表版本不能为空', trigger: 'blur'}
				]
			}
		}
	},
	mounted() {
	},
	methods: {
		//显示
		open() {
			this.visible = true;
			return this
		},
		submit() {
			this.$refs.dialogForm.validate(async (valid) => {
				if (valid) {
					this.isSaveing = true;
					this.$emit('success',this.form)
					this.isSaveing = false;
					this.visible = false;
				}
			})
		},
	}
}
</script>
